import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '../components/Layout.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    title:'根目录',
    children: [
      {
        path: '/about',
        name: 'about',
        // route level code-splitting
        // this generates a separate chunk (about.[hash].js) for this route
        // which is lazy-loaded when the route is visited.
        component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
      },
      {
        path: '/home',
        title:'首页',
        component: () => import('../views/HomeView.vue')
      },
      {
        path:'/system',
        component:Layout,
        name:'system',
        title:'系统设置',
        children:[
          {
            path:'/user',
            title:'用户设置',
            name:'user',
            component:()=>import('../components/User.vue'),
          },
          {
            path:'/profile',
            title:'用户信息',
            name:'user',
            component:()=>import('../components/Profile.vue')
          }
        ]
      },
      {
        path:'/password',
        title:'密码',
        name:'role',
        component:()=>import('../components/Password.vue')
      },
      {
        path:'avatar',
        title:'头像',
        component:()=>import('../components/Avatar.vue')
      }
    ]
  }
  ]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
